<?php
class ModelTotalSubTotal extends Model {
	public function getTotal(&$total_data, &$total, &$taxes, $status = 0) {
		if ($this->config->get('sub_total_status')) {
			$this->load->language('total/sub_total');
			
			$sub_total = $this->cart->getSubTotal();
			if (isset($this->session->data['giftcards']) && $this->session->data['giftcards']) {
				foreach ($this->session->data['giftcards'] as $giftcard) {
					$sub_total += $giftcard['amount'];
				}
			}
			
			$total_data['subtotal'] = array( 
        		//'title'      => $this->language->get('text_sub_total'),          		
        		//'text'       => $this->currency->format($this->cart->getSubTotal()),
                'title'      => 'Subtotal',                  
        		'text'       => $this->currency->formatPrice($sub_total),
        		'value'      => $sub_total,
				'sort_order' => $this->config->get('sub_total_sort_order'),
				'total_code' => '',
			);
			
			$total += $sub_total;
		}
	}
	
	public function getTotalSubtotal(&$total_data, &$total, &$taxes) {
		if ($this->config->get('sub_total_status')) {
			$this->load->language('total/sub_total');
			
			$total_data[] = array( 
        		'title'      => $this->language->get('text_sub_total'),          		
        		//'text'       => $this->currency->format($this->cart->getSubTotal()),
        		'text'       => $this->currency->formatPrice($this->cart->getSubTotal()),
        		'value'      => $this->cart->getSubTotal(),
				'sort_order' => $this->config->get('sub_total_sort_order')
			);
			
			$total += $this->cart->getSubTotal();
		}
	}
}
?>